<!DOCTYPE html>
<html lang="en">
<include file="CommonSidebar:common-head"/>
<link href="__ROOT__/Application/Admin/Public/css/jquery.datetimepicker.css" rel="stylesheet">
<link href="__PUBLIC__/LoadPading/LoadPading.css" rel="stylesheet">
<style>
    #qrcode canvas {
        width: 100%;
        height: 100%;
    }
</style>
<body>

<div id="wrapper">

    <!-- Navigation -->
    <include file="CommonSidebar:common-navbar"/>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">批量导入图书</h1>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                            <div class="panel panel-default">
                                <div class="panel-heading" role="tab" id="headingOne">
                                    <h4 class="panel-title">
                                        <a role="button" data-toggle="collapse" data-parent="#accordion"
                                           href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                            批量导入书籍
                                        </a>
                                    </h4>
                                </div>
                                <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel"
                                     aria-labelledby="headingOne">
                                    <div class="panel-body">
                                        <if condition="$DATA">
                                            <div class="form-group">
                                                <label class=" control-label " style="color: red">数据上传成功！！！需要再次导入点击清除再导入即可</label>
                                            </div>
                                            <br/>
                                            <a href="{:U('/Book/clear')}"><input type="button"
                                                                                 class="btn btn-success"
                                                                                 value="清除"/></a>
                                            <else/>
                                            <form role="form" action="{:U('importXLS')}" method="post" id="Frm"
                                                  enctype='multipart/form-data'>
                                                <div class="form-group">
                                                    <label class=" control-label " style="color: red">导入数据文件(必填) :
                                                        导入数据必须严格按照规定格式，注意数据长度</label>
                                                </div>
                                                <div class="form-group">
                                                    <input type="file" name="execel" class="form-control" required>
                                                </div>
                                                <div class="form-group">
                                                    <input type="submit" class="btn btn-success" value="导入"/>

                                                </div>
                                            </form>
                                        </if>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        商品
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                <tr>
                                    <th>书名</th>
                                    <th>条形码ISBN</th>
                                    <th>作者</th>
                                    <th>出版社</th>
                                    <th>出版日期</th>
                                    <th>包装规格</th>
                                    <th>书籍开本</th>
                                    <th>语言</th>
                                    <th>页数</th>
                                    <th>预计阅读时间</th>
                                    <th>阅读年龄</th>
                                    <th>库存</th>
                                    <th>原价</th>
                                    <th>销售价格</th>
                                    <th>租金</th>
                                    <th>滞纳金</th>
                                    <th>书籍新旧水平</th>
                                    <th>借阅次数</th>
                                    <th>入库时间</th>
                                    <th>图书状态</th>
                                    <th>书籍成本</th>
                                    <th>书籍重量</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="DATA" item="v" key="k">
                                    <tr class="odd gradeX">
                                        <td>{$v.TITLE}</td>
                                        <td>{$v.ISBN}</td>
                                        <td>{$v.AUTHOR}</td>
                                        <td>{$v.PRESS}</td>
                                        <td>{$v.PUBLICATION_DATE}</td>
                                        <td>{$v.PACKING_SPECIFICATION}</td>
                                        <td>{$v.BOOK_SIZE}</td>
                                        <td>{$v.LANGUAGES}</td>
                                        <td>{$v.PAGE}</td>
                                        <td>{$v.YJ_READ_TIME}</td>
                                        <td>{$v.AGE}</td>
                                        <td>{$v.STOCK}</td>
                                        <td>{$v.Y_PRICE}</td>
                                        <td>{$v.XS_PRICE}</td>
                                        <td>{$v.RENT}</td>
                                        <td>{$v.ZN_PRICE}</td>
                                        <td>{$v.LEVEL}</td>
                                        <td>{$v.BORROW_NUM}</td>
                                        <td>{$v.RUKU_TIME}</td>
                                        <td>{$v.STATE}</td>
                                        <td>{$v.COST}</td>
                                        <td>{$v.KG}</td>
                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
    </div>
    <!-- /#page-wrapper -->

</div>
<div class="modal fade dialogsecc" id="myModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header" style="height:30px;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"></h4>
            </div>
            <div class="modal-body">
                <div class="progress" style="    background: #CCC;    margin: 0;    height: 50px;    border-radius: 0;">
                    <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0"
                         aria-valuemax="100" style="width: 60%; ">
                        60%
                    </div>
                </div>
            </div>
            <div class="modal-footer" style="height:30px;">

            </div>
        </div>
    </div>
</div>

<include file="CommonSidebar:common-script"/>
<!-- Custom Theme JavaScript -->
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<script type="text/javascript" src="__ROOT__/Application/Admin/Public/js/uploadPreview.js"></script>
<script type="text/javascript" src="__ROOT__/Application/Admin/Public/js/jquery.form.min.js"></script>
<script type="text/javascript" src="__ROOT__/Application/Admin/Public/js/jquery.qrcode.min.js"></script>
<script src="__PUBLIC__/js/address.js"></script>
<script src="__PUBLIC__/LoadPading/LoadPading.js"></script>

<script>
    $('.bindbutt').click(function () {
        if (confirm("批量更新数据后，原数据就改变？是否确认")) {
            var counts = {$counts};
            ajaxing(counts);
        }
    });
    function ajaxing(counts) {
        alert("总共更新数据:" + counts + "条");
        ajaxing2(0, counts);
    }
    function ajaxing2(id, counts) {
        var jdd = ((id / counts) * 100);
        $(".progress-bar").html(jdd.toFixed(1) + '%').width(jdd + '%');
        if (id < counts) {
            $("#myModal").modal();
            $.post("{:U('importYZ')}",
                    {id: id},
                    function (data) {
                        setTimeout(ajaxing2((id + 1), counts), 300);
                    });
        } else {
            location.reload();
            return false;
        }
    }
</script>


</body>

</html>
